import java.util.Arrays;
import java.util.Collections;
import java.util.List;


public class Leetcode1464 {
    public int maxProduct(int[] nums) {
        int max1 = Integer.MIN_VALUE;
        int max2 = Integer.MIN_VALUE;

        for (int num : nums) {
            if (num > max1) {
                max2 = max1;
                max1 = num;
            } else if (num > max2) {
                max2 = num;
            }
        }
        return (max1-1) * (max2-1);
    }
}

